// 能耗监测 模块

import { SystemSpace } from "@/api/interface/energy"
import http from "@/api"

// ------------------历史数据分析----------------- //
// 历史数据查询
export const historyStat = (params: SystemSpace.HistoryStatQuery) => {
  return http.post<SystemSpace.HistoryStat[]>("/history/stat/list", params)
}

// 历史数据导出
export const exportHistoryData = (params: SystemSpace.ExportHistoryDataQuery) => {
  return http.download("/history/stat/export", params)
}

// ------------------实时监测分析----------------- //
// 查询三项电流统计集合
export const RealTimeStatQuery = (params: { deviceId: number }) => {
  return http.get<
    Array<{
      valueA: number
      valueB: number
      valueC: number
      dataTime: string
    }>
  >("stat/current/list", params)
}

// 实时数据监测
export const realTimeStat = (params: SystemSpace.RealTimeStatQuery) => {
  return http.get<SystemSpace.RealTimeStat[]>("/monitor/stat/realTime", params)
}

// ------------------电能质量分析----------------- //
// 负荷数据
export const electricStat = (params: SystemSpace.ElectricStatQuery) => {
  return http.post<SystemSpace.ElectricStat>("/stat/electric/load", params)
}
